#scp -r api common static app.py root@47.97.215.145:/software/3d_printer/api/

apifiles="conf api common app.py"

server="120.27.68.231"
path="/root/sunbox_tools/appspath/api"
user="root"
password="Yanghf*1024"

expect -c "
spawn scp -r ${apifiles} ${user}@${server}:${path}
expect {
\"*assword\" {set timeout 300; send \"${password}\r\";}
\"yes/no\" {send \"yes\r\"; exp_continue;}
}
expect eof" || { echo "复制文件到服务器失败！"; exit 1; }